﻿using Microsoft.EntityFrameworkCore;
using PYNET.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace PYNET.Data
{
    public class ArticleSystemDbContext:DbContext
    {
        public ArticleSystemDbContext(DbContextOptions<ArticleSystemDbContext> options)
            :base(options)
        {
        }
        public DbSet<Article> Articles { get; set; }
        public DbSet<Comment> Comments { get; set; }
        public DbSet<UserArticleLike> UserArticleLikes { get; set; }
        public DbSet<UserCommentLike> UserCommentLikes { get; set; }
        public DbSet<ArticleRequest> ArticleRequests { get; set; }

        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            modelBuilder.Entity<Article>().ToTable("Article");
            modelBuilder.Entity<Comment>().ToTable("Comment");
            modelBuilder.Entity<UserArticleLike>().ToTable("UserArticleLike");
            modelBuilder.Entity<UserCommentLike>().ToTable("UserCommentLike");
            modelBuilder.Entity<ArticleRequest>().ToTable("ArticleRequest");
        }

    }
}
